#include <includes.h>
#include "cloud_aopu.h"
#include "mqtt_config.h"

int vdata_csv_write(char *path)
 {
     FILE *fp = NULL; //需要注意
     fp = fopen(path, "a");
     if(NULL == fp)
     {
         return -1; //返回错误代码
     }
     char *a = "a";
     char *b = "b";
     char *c = "c";
       fprintf(fp, "%s,%s,%s\n", a, b, c);  //写入a,b,c到文件中

     fclose(fp);
     fp = NULL; //需要指向空，否则会指向原打开文件地址
     return 0;
 }



int main(void)
{
    char printf_buff[1024];
    int res = 0;
    vdata_mqtt_gateway_info_t gateway;

    mqtt_modbus_read_config_file();
    do{
        memset(printf_buff, 0, sizeof(printf_buff));
        res = vdata_report_data_notif3(&gateway, printf_buff);
        printf("%s\r\n\r\n", printf_buff);
    }while(res != 0);

    mqtt_modbus_config_update(1, 3, 208, 55);

    do{
        memset(printf_buff, 0, sizeof(printf_buff));
        res = vdata_report_data_notif3(&gateway, printf_buff);
        printf("%s\r\n\r\n", printf_buff);
    }while(res != 0);
}

